package com.chaoyong.higo.adapter;

import com.chaoyong.higo.R;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class WodeAdapter extends BaseAdapter {

	private String msgs[] = { "夺宝记录", "中奖纪录", "晒单记录", "夺宝红包", "收货信息", "账户明细", "联系客服" };
	private int images[] = { R.drawable.duobaojilu, R.drawable.zhongjiangjilu, R.drawable.shaidanjilu,
			R.drawable.duobaohongbao, R.drawable.shouhuoxinxi, R.drawable.zhanghumingxi, R.drawable.lianxikefu };

	private LayoutInflater inflater;
	private Context context;

	public WodeAdapter(Context context) {
		inflater = LayoutInflater.from(context);
		this.context = context;
	}

	@Override
	public int getCount() {
		return msgs.length;
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return msgs[position];
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		ViewHolder viewHolder;
		if (convertView == null) {
			viewHolder = new ViewHolder();
			convertView = inflater.inflate(R.layout.itme_my_purchase, null);
			viewHolder.imageView = (ImageView) convertView.findViewById(R.id.iv_icon1);
			viewHolder.title = (TextView) convertView.findViewById(R.id.tv_icon1);
			convertView.setTag(viewHolder);
		} else {
			viewHolder = (ViewHolder) convertView.getTag();
		}
		viewHolder.title.setText(msgs[position]);
		viewHolder.imageView.setBackgroundResource(images[position]);
		return convertView;
	}

	class ViewHolder {
		private ImageView imageView;
		private TextView title;
	}

}
